/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/container
// Copyright (c) 2014.  All Rights Reserved
//
// File:		AEArrayUtil.h
// Author:		Gianluca Belardelli
// Date:		27/05/2014
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEARRAYUTIL_H_
#define _AEARRAYUTIL_H_

class AE_COREDLLIMPEXP AEArrayUtil
{
// Methods
public:
	template<typename T> static AE_FORCEINLINE void Construct( T *tElem, AEINT32 nNumElem, AETypeIsPod );
	template<typename T> static AE_FORCEINLINE void Construct( T *tElem, AEINT32 nNumElem, AETypeIsClass );

	template<typename T> static AE_FORCEINLINE void ConstructWithCopy( T *tElem, AEINT32 nNumElem, const T &tCopy, AETypeIsPod );
	template<typename T> static AE_FORCEINLINE void ConstructWithCopy( T *tElem, AEINT32 nNumElem, const T &tCopy, AETypeIsClass );

	template<typename T> static AE_FORCEINLINE void Destruct( T *tElem, AEINT32 nNumElem, AETypeIsPod );
	template<typename T> static AE_FORCEINLINE void Destruct( T *tElem, AEINT32 nNumElem, AETypeIsClass );

	template<typename T> static AE_FORCEINLINE void ConstructWithArray( T *tElem, AEINT32 nNumElem, const T *tCopy, AETypeIsPod );
	template<typename T> static AE_FORCEINLINE void ConstructWithArray( T *tElem, AEINT32 nNumElem, const T *tCopy, AETypeIsClass );

	static AEUINT32 AE_CALL Reserve( AEMemoryAllocator &maAlloc, void *lpArray, AEINT32 nReqElem, AEINT32 nSizeElem );
	static void AE_CALL ReserveMore( AEMemoryAllocator &maAlloc, void *lpArray, AEINT32 nSizeElem );
	static void AE_CALL Reduce( AEMemoryAllocator &maAlloc, void *lpArray, AEINT32 nSizeElem, char *lpInplaceMem, AEINT32 nRequestedCapacity );
};

#include "AEArrayUtil.inl"

#endif // _AEARRAYUTIL_H_

